package com.smart.home.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.smart.home.dao.UpPicMapper;
import com.smart.home.model.PicModel;
import com.smart.home.service.UpPicService;
import com.smart.home.system.DataGrid;

@Service
public class UpPicServiceImpl implements UpPicService{

	@Autowired
	private UpPicMapper picMapper;

	@Override
	public DataGrid getPicList(Map<String, Object> params) throws Exception{
		DataGrid grid = new DataGrid();
		List<PicModel> picList = picMapper.getPicList(params);
		Long total = picMapper.getPicCount(params);
		grid.setRows(picList);
		grid.setTotal(total);
		return grid;
	}

	@Override
	public int delPic(Integer picId) throws Exception {
		return picMapper.delPic(picId);
	}

	@Override
	public int updatePicStatus(Integer picId,Integer isAble) throws Exception {
		return picMapper.updatePicStatus(picId, isAble);
	}

	@Override
	public int addPic(PicModel picModel) throws Exception {
		return picMapper.addPic(picModel);
	}
	
}
